<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../template/WorkspaceTemplate.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core">

    <ui:define name="top">
        
    </ui:define>

    <ui:define name="left">
    </ui:define>

    <ui:define name="right">
       
    </ui:define>

    <ui:define name="content">
        <h:form id="form1">
            <p:panel>
                <h:panelGrid columns="3" columnClasses="label, value" styleClass="grid">
                    <h:outputText style="font-weight: bold" value="Email Address: *"/>
                    <p:inputText required="true" label="Email Address" requiredMessage="Email address is required."
                                 id="emailAddr" value="#{workspaceManagerBean.currentStaff.systemUserAccount.emailAddress}"
                                 validator="#{workspaceManagerBean.checkEmailExists}">
                        <f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]"/>
                    </p:inputText>
                    <p:message for="emailAddr"/>
                    
                    <h:outputLabel value="Old password"/>
                    <h:inputSecret required="true" requiredMessage="Please input your old password."
                                   id="oldpwd" value="#{workspaceManagerBean.oldPassword}"
                                   validator="#{workspaceManagerBean.checkOldPassword}"/>
                    <p:message for="oldpwd"/>

                    <h:outputText value="New password"/>
                    <p:password id="pwd" inline="true" feedback="true" minLength="6" value="#{workspaceManagerBean.newPassword}" required="true" requiredMessage="Please input password."/>
                    <p:message for="pwd"/>

                    <h:outputText value="Re-enter password:"/>
                    <h:inputSecret id="pwd2" validator="#{workspaceManagerBean.validateSamePassword}" required="true" requiredMessage="Please re-enter the password"/>
                    <p:message for="pwd2"/>
                </h:panelGrid>
            </p:panel>

            <p:commandButton value="Save Changes" ajax="false" actionListener="#{workspaceManagerBean.saveChanges}"/>
            <p:commandButton value="Cancel" ajax="false" action="#{workspaceManagerBean.redirectToProfilePage}"/>
        </h:form>
    </ui:define>

    <ui:define name="bottom">
       
    </ui:define>

</ui:composition>
